#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from flask_migrate import Migrate
from flask_jwt_extended import JWTManager
from flask_marshmallow import Marshmallow
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address

# 初始化SQLAlchemy
db = SQLAlchemy()

# 初始化CORS
cors = CORS()

# 初始化数据库迁移
migrate = Migrate()

# 初始化JWT
jwt = JWTManager()

# 初始化Marshmallow (用于序列化/反序列化)
ma = Marshmallow()

# 初始化请求限流器
limiter = Limiter(
    key_func=get_remote_address,
    default_limits=["200 per day", "50 per hour"]
) 